///<reference path="../../../TS/Config.ts"/>
declare let plus:any;
Config.debug=true;
Menu.Menu.menu=[
    new Menu.Item('用户','User',[0],'',[
        new Menu.Item('自动登陆中','User',[0],'AutoLogin'),
        new Menu.Item('用户登陆','User',[0],'Login'),
        new Menu.Item('用户注册','User',[0],'Reg'),
        new Menu.Item('个人中心','User',[0],'Mine'),
        new Menu.Item('找回密码','User',[0],'Forget')
    ]),
];
Config.ready=function () {
	// 编写准备就绪的执行代码
    let Auth:any = Castle.Cache.get('Auth');
    if(Auth instanceof Object){
        Castle.Request.post(Config.getRequestUrl('UserAccount','Login'),{
            Account:Auth.Account,
            PWD:Auth.PWD
        },function (data) {
            tip('自动登陆成功')
        },function (err) {
            tip(err)
        })
    }else{
        goto('User','Login',0,'User');
    }
};
Config.loginFn=function () {
      Castle.Request.post(Config.getRequestUrl('UserAccount','Login'),{
          Account:index.loginInput.Account,
          PWD:index.loginInput.PWD
      },function (data) {
          goto('Machine','List',0,'Machine');
      },function (err) {
          tip(err);
      })
};
Config.logoutFn=function () {

};

let tip=function (msg) {
    mui.toast(msg)
};
enum Tip{
}